perm filename FAKE22.SAI[DOC,TOB] blob
sn#081037 filedate 1974-01-07 generic text, type T, neo UTF8
00100 comment
00200 this version has only the loop for finding the
00300 min step for 50% detection of edges, with 1%
00400 false positives on zero height edges;
00500
00600 BEGIN "EDGE_TEST"
00700 comment
00800 find best choice of conf and diff for Hueckel edge
00900 operator based on chosen false positive rate for
01000 no signal. For a given false positive rate, find
01100 choice which requires the least height step to
01200 achieve a 50% false negative rate. This uses
01300 steps generated by a Monte Carlo procedure;
01400
01500 DEFINE SAFE_ARRAY=1; comment this makes all arrays safe;
01600 REQUIRE "VISION.2[SYS,TOB]" SOURCE_FILE; comment vision language package;
01700 REQUIRE EDGE_FILE;
01800 REQUIRE EDGE_PRINT;
01900 REQUIRE TV_VARIABLES;
02000 REQUIRE FAKE_FILE; ! file for fake edges;
02100
02200
02300 EJINIT; ! init Hueckel operator;
02400 MODIFY(BITS);
02500 WHILE YES("TEST EDGE OPERATOR? ") DO BEGIN "TST_LOOP"
02600 ASK_FAKE;
02700 FAKE;
02800 OP_APPLY(NBHD_FAKE/2,NBHD_FAKE/2); ! try the edge operator on it;
02900 END "TST_LOOP";
03000
03100
03200 ASK_FAKE;
00100 WHILE TRUE DO BEGIN "FALSE_NEG"
00200 INTEGER ENOUGH;
00300 INTEGER K;
00400 DEFINE MAX_COUNT=5000;
00500 REAL_ARRAY N0SQA[1:MAX_COUNT];
00600 REAL_ARRAY S0SQA[1:MAX_COUNT];
00700 ENOUGH←2000;
00800 MODIFY(ENOUGH);
00900 IF ENOUGH>MAX_COUNT THEN ENOUGH←MAX_COUNT;
01000
01100 comment generate a lot of events and save s0sq,n0sq;
01200 ASK_MODIFY(CRLF&"HEIGHT OF EDGE IN UNITS OF RMS NOISE ",RATIO_FAKE);
01300 STEP_FAKE←RATIO_FAKE*NOISE_FAKE;
01400 PRINT(STEP_FAKE);
01500 DIFF←CONF←0; ! turn off the cutoffs to reject nothing;
01600 FOR K←1 STEP 1 UNTIL ENOUGH DO BEGIN "ACCUM"
01700 REPORT_PROGRESS(K,20);
01800 FAKE;
01900 EJLI(NBHD_FAKE/2,NBHD_FAKE/2,0,0); ! try the edge operator on it;
02000 N0SQA[K]←N0SQ;
02100 S0SQA[K]←S0SQ;
02200 END "ACCUM";
02300
00100 BEGIN "MIN_STEP"
00200 PRELOAD_WITH 1.250,1.350,1.350,1.400,1.400,1.400,
00300 1.400,1.400,1.400,1.400,1.400,1.400,1.400;
00400 OWN REAL ARRAY DIFF_CUTOFF[1:20]; ! cutoffs for diff;
00500 REAL NSQ;
00600 NSQ←NOISE_FAKE↑2;
00700 comment for a range of conf values, and corresponding diff values, find
00800 number of rejections of fake edges;
00900
01000 FOR CONF←.95 STEP -.05 UNTIL .40 DO BEGIN "CONF_LOOP" ! loop over conf;
01100 SHORT REAL CONFSQ;
01200 INTEGER CONF_INDEX;
01300 SHORT INTEGER POSITIVES;
01400 CONF_INDEX←1+(.95-CONF)/.05;
01500 CONFSQ←CONF↑2;
01550 POSITIVES←0;
01600 FOR K←1 STEP 1 UNTIL ENOUGH DO BEGIN "COUNT"
01700 SHORT REAL S;
01800 S←S0SQA[K];
01900 IF S/(S+N0SQA[K])>CONFSQ THEN BEGIN ! if above conf;
02000 IF S>DIFF_CUTOFF[CONF_INDEX]*NSQ THEN POSITIVES←POSITIVES+1;
02100 END;
02200 END "COUNT";
02300 TCRLF;
02400 PRINT(CONF);OUTSTR(" "&CVG(DIFF_CUTOFF[CONF_INDEX]*NSQ));
02500 OUTSTR(" "&CVG(DIFF_CUTOFF[CONF_INDEX]));
02600 PRINT(ENOUGH);PRINT(POSITIVES);
02700 END "CONF_LOOP";
02800 END "MIN_STEP";
02900 END "FALSE_NEG";
03000 END "EDGE_TEST";